updating oE dir_size
dir_size
include filesys.e namespace filesys public function dir_size(sequence dir_path, integer count_all = 0)
returns the amount of space used by a directory.
Parameters:
- dir_path : A sequence. This is the path that identifies the directory to inquire upon.
- count_all : An integer. Used by Windows systems. If zero (the default) it will not include system or hidden files in the count, otherwise they are included.
Returns:
A sequence, containing four elements; the number of sub-directories [COUNT_DIRS], the number of files [COUNT_FILES], the total space used by the directory [COUNT_SIZE], and breakdown of the file contents by file extension [COUNT_TYPES].
Comments:
- The total space used by the directory does not include space used by any sub-directories.
- The file breakdown is a sequence of three-element sub-sequences. Each sub-sequence contains the extension [EXT_NAME], the number of files of this extension [EXT_COUNT], and the space used by these files [EXT_SIZE]. The sub-sequences are presented in extension name order. On Windows the extensions are all in lowercase.
Example 1:
res = dir_size("/usr/localbin") printf(1, "Directory %s contains %d files\n", { "/usr/localbin", res[COUNT_FILES] }) for i = 1 to length(res[COUNT_TYPES]) do printf(1, "Type: %s (%d files %d bytes)\n", { res[COUNT_TYPES][i][EXT_NAME], res[COUNT_TYPES][i][EXT_COUNT], res[COUNT_TYPES][i][EXT_SIZE] }) end for
Not Categorized, Please Help
|